/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package me.joshua.demo4j.spring.mvc.thymeleaf;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * 
 * @author Joshua
 */
@Controller
public class Hello {

	private static final Logger LOGGER = LoggerFactory.getLogger(Hello.class);

	@RequestMapping(value = "/{name}", method = RequestMethod.GET)
	public String greeting(@PathVariable String name, Model model) {
		LOGGER.info(String.format("Name is %s", name));
		model.addAttribute("name", name);
		return "/hello";
	}
}
